home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…stman Always Clicks Twice / ADC Developer CD (1993-01) (''The Postman Always Clicks Twice'')_iso / Dev.CD 199301.iso / Development Platforms / LISP Related / LISP Goodies / AV Parser / Sample Grammars / 01 Simplest Grammar.Lisp < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.1 KB  |  42 lines  |  [TEXT/CCL2]

  1. ;;; 01 Simplest Grammar.Lisp
  2. ;;;
  3. ;;; A grammar that generates one string, viz. "Uther sleeps".
  4. ;;; Based on Shieber's example in Chapter, Section 3, pp. 21-22.
  5. ;;; It also generates two other strings (what are they?).
  6. ;;;
  7. ;;; The parser ignores anything following a semi-colon to the end of a line,
  8. ;;; so anything following a semi-colon is a comment to you, dear reader!
  9. ;;;
  10. ;;; Read this grammar into the parser by choosing "Eval Buffer" from the
  11. ;;; "Eval" menu.  Then enter "(p uther sleeps)" in the Listener (and press
  12. ;;; Return) to parse the utterance "Uther sleeps".  You should see a
  13. ;;; Tree Window displaying a parse tree, and an Avm Window displaying the
  14. ;;; the features associated with the top node in that tree.
  15.  
  16.  
  17. #[     ; this tells Lisp to beging reading a grammar.
  18.  
  19.  
  20. ; AV Parser notation                                 Shieber's notation
  21. ; ------------------                                 ------------------
  22.  
  23. _ --> _ _ :                                       ;  X0 --> X1 X2
  24.   cat(*0) = s,                                    ;     <X0 cat> = s
  25.   cat(*1) = np,                                   ;     <X1 cat> = np
  26.   cat(*2) = vp,                                   ;     <X2 cat> = vp
  27.   head(*0) = head(*2),                            ;     <X0 head> = <X2 head>
  28.   subject(head(*0)) = head(*1).                   ;     <X0 head subject> = <X1 head>
  29.  
  30. uther :                                           ; Word uther:
  31.   cat(*) = np,                                    ;     <cat> = np
  32.   number(agreement(head(*))) = singular,          ;     <head agreement number> = singular
  33.   person(agreement(head(*))) = third.             ;     <head agreement person> = third
  34.  
  35. sleeps :                                          ; Word sleeps:
  36.   cat(*) = vp,                                    ;     <cat> = vp
  37.   form(head(*)) = finite,                         ;     <head form> = finite
  38.   number(agreement(subject(head(*)))) = singular, ;     <head subject agreement number> = singular
  39.   person(agreement(subject(head(*)))) = third.    ;     <head subject agreement person> = third
  40.   
  41. #]   ; end of grammar.
  42.